package me.khrystal.rxnews.module.news.presenter;

import java.util.List;

import me.khrystal.rxnews.base.BasePresenter;
import me.khrystal.rxnews.base.BasePresenterImpl;
import me.khrystal.rxnews.greendao.NewsChannelTable;
import me.khrystal.rxnews.module.news.model.INewsInteractor;
import me.khrystal.rxnews.module.news.model.INewsInteractorImpl;
import me.khrystal.rxnews.module.news.view.INewsView;

/**
 * usage: 新闻代理接口实现
 * author: kHRYSTAL
 * create time: 16/4/18
 * update time:
 * email: 723526676@qq.com
 */
public class INewsPresenterImpl extends BasePresenterImpl<INewsView,List<NewsChannelTable>> implements INewsPresenter{

    private INewsInteractor<List<NewsChannelTable>> mNewsInteractor;

    public INewsPresenterImpl(INewsView view) {
        super(view);
        mNewsInteractor = new INewsInteractorImpl();
        mSubscription = mNewsInteractor.operateChannelDb(this);
        mView.initRxBusEvent();
    }

    @Override
    public void onDestory() {
        super.onDestory();
    }

    @Override
    public void requestSuccess(List<NewsChannelTable> data) {
        super.requestSuccess(data);
        mView.initViewPager(data);
    }

    @Override
    public void onprateChannelDb() {
        mSubscription = mNewsInteractor.operateChannelDb(this);
    }


}
